<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 

class Helloworld {	
	function __construct() {

		$this->info["name"] = "Helloworld";
		$this->info["caption"] = "Helloworld is a tester API that helps developers build they own API function and method.";


		/* /testing GET METHOD RULES */
		$testing_rules["desc"] = "API example in GET method";
		$testing_rules["params"]["text"]["type"] = "string";
		$testing_rules["params"]["text"]["required"] = true;
		$testing_rules["params"]["text"]["desc"] = "Specify the tweet text";
		$testing_rules["params"]["text"]["example"] = "helloworld my api cobacoba";

		$testing_rules["output_sample"] = "";
		$this->info["methods"]["GET"]["testing"] = $testing_rules;
		/* /testing GET METHOD RULES */			

		/* /baca GET METHOD RULES */
		$testing_rules["desc"] = "Baca API example in GET method";
		$testing_rules["public"] = true;		
		$testing_rules["params"]["text"]["type"] = "string";
		$testing_rules["params"]["text"]["required"] = true;
		$testing_rules["params"]["text"]["desc"] = "Specify the tweet text";
		$testing_rules["params"]["text"]["example"] = "helloworld my api cobacoba";

		$testing_rules["output_sample"] = "";
		$this->info["methods"]["GET"]["baca"] = $testing_rules;
		/* /baca GET METHOD RULES */						  

		/* /testing POST METHOD RULES */
		$testing_rules["desc"] = "API example in POST method";
		$this->info["methods"]["POST"]["testing"] = $testing_rules;
		/* /testing POST METHOD RULES */							  

		/* /testing PUT METHOD RULES */
		$testing_rules["desc"] = "API example in PUT method";
		$this->info["methods"]["PUT"]["testing"] = $testing_rules;
		/* /testing PUT METHOD RULES */							  

		/* /testing DELETE METHOD RULES */
		$testing_rules["desc"] = "API example in DELETE method";
		$this->info["methods"]["DELETE"]["testing"] = $testing_rules;
		/* /testing GET METHOD RULES */							  

	}
	
	function GET_testing() {
		$ci =& get_instance();
		$this->status = 200;
		$this->error = null;
		$this->response = "This is an API result on {$this->method} method! Your text is: {$this->params['text']}";

	}

	function GET_baca() {
		$ci =& get_instance();
		$this->status = 200;
		$this->error = null;
		$this->response = "This is an API result on {$this->method} method! Your text is: {$this->params['text']}";

	}

	function POST_testing() {
		$ci =& get_instance();
		$this->status = 200;
		$this->error = null;
		$this->response = "This is an API result on {$this->method} method! Your text is: {$this->params['text']}";
	}

	function PUT_testing() {
		$ci =& get_instance();
		$this->status = 200;
		$this->error = null;
		$this->response = "This is an API result on {$this->method} method! Your text is: {$this->params['text']}";
	}

	function DELETE_testing() {
		$ci =& get_instance();
		$this->status = 200;
		$this->error = null;
		$this->response = "This is an API result on {$this->method} method! Your text is: {$this->params['text']}";
	}

}

